package com.wei;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.wei.entity.Video;
import com.wei.service.VideoService;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @author wjx
 * @ClassName test
 * @description: TODO
 * @date 2022-12-02 06:11
 * @version: 1.0
 */
@SpringBootTest
public class test {
    @Autowired
    private VideoService videoService;

    @Test
    public void test1() {
        LambdaQueryWrapper<Video> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(Video::getCourseId, "1598436072579248130");
        List<Video> videoList = videoService.list(queryWrapper);


        List<String> stringList = videoList.stream().filter(video -> video.getVideoSourceId() != null)
                .map(video -> video.getVideoSourceId()).collect(Collectors.toList());

        System.out.println("====" + Arrays.toString(stringList.toArray()));
    }
}
